package org.litespring.core.type.classreading;


import org.litespring.core.annotation.AnnotationAttributes;
import org.springframework.asm.AnnotationVisitor;
import org.springframework.asm.SpringAsmInfo;

import java.util.Map;


final class AnnotationAttributesReadingVisitor extends AnnotationVisitor {

	private final String annotationType;//传过来的注解的全限定类名

	//是从AnnotationMetadataReadingVisitor传过来的实体map。key是注解的全限定类名，value是注解的各个属性
	private final Map<String, AnnotationAttributes> attributesMap;

	//是一个map ，里面存放的是注解后面的属性    比如(value="petS")
	AnnotationAttributes attributes = new AnnotationAttributes();


	public AnnotationAttributesReadingVisitor(String annotationType, Map<String, AnnotationAttributes> attributesMap) {
		super(SpringAsmInfo.ASM_VERSION);
		
		this.annotationType = annotationType;
		this.attributesMap = attributesMap;
		
	}
	@Override
	public final void visitEnd(){
		this.attributesMap.put(this.annotationType, this.attributes);
	}

	@Override
	public void visit(String attributeName, Object attributeValue) {
		//就是company后面的    value="petStore"
		this.attributes.put(attributeName, attributeValue);
	}


}
